<template>
  <div>
    <div id="signature-area"></div>
    <button @click="saveSignature">保存签名</button>
  </div>

</template>
<script>
  import {fabric} from 'fabric';
  export default {
    name: 'Signature',
    mounted() {
// 实例化fabric canvas
      this.canvas = new fabric.Canvas('signature-area', {
        isDrawingMode: true
      });
    },
    methods: {
// 保存签名
      saveSignature() {
        const dataUrl = this.canvas.toDataURL({
          format: 'png',
          quality: 1,
          enableRetinaScaling: 1,
          multiplier: 1
        });
// 保存数据
      }
    }
  }
</script>
